<template>
  <div class="index">
    <el-container style="height: 100%; border: 1px solid #eee">
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
        <el-menu :default-openeds="['1']" router>
              <el-menu-item index="/index/upload">图片管理</el-menu-item>
              <el-menu-item index="/index/logistics">物流线路管理</el-menu-item>
              <el-menu-item index="/index/user">用户管理</el-menu-item>
        </el-menu>
      </el-aside>

      <el-container>
        <el-header style="text-align: right; font-size: 12px; background-color:#eee">
          <el-dropdown>
            <p style="margin: 20px;">欢迎：{{username}}</p>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click="logout">退出</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-header>

        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
  </el-container>
  </div>
</template>

<script>

export default {
  name: 'index',
  data() {
    return {
      username:''
    }
    
  },
  methods:{
    getUsername() {
      this.username = localStorage.getItem('username')
    },
    logout() {
      localStorage.removeItem('username')
      localStorage.removeItem('token')
      this.$router.push({ path:'/' })
    }
  },
  mounted() {
    this.getUsername()
  }
}
</script>

<style scoped>

</style>
